﻿@model SDSystem.Models.Dish
@{
    ViewBag.Title = "Edit Dishes";
    Layout = "~/Views/Shared/_LayoutHtml.cshtml";
}

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        @Html.HiddenFor(m=>m.DishesId)
        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Image)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Image, new {@id = "DishImage"})
            @Html.ValidationMessageFor(model => model.Image)
            <input type="button" value="Browser..." id="btnImage"/>
            <script type="text/javascript">
                $(document).ready(function() {
                    $("#btnImage").click(function() {
                        var ckImage = new CKFinder();
                        ckImage.selectActionFunction = function(fileUrl) {
                            $("#DishImage").val(fileUrl);
                        };
                        ckImage.popup();
                    });
                });
            </script>
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(m => m.Description, new {@id = "descriptionCk"})
            <script type="text/javascript">
                var editorContent = CKEDITOR.replace("descriptionCk"
                    //                    ,{
                    //                        toolbar : 'Basic'
                //                    }
                );
                CKFinder.setupCKEditor(editorContent, '/ckfinder/');
            </script>
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.DContent)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(m => m.DContent, new {@id = "contentCk"})
            <script type="text/javascript">
                var editorContent = CKEDITOR.replace("contentCk");
                CKFinder.setupCKEditor(editorContent, '/ckfinder/');
            </script>
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Recipe)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(m => m.Recipe, new {@id = "recipeCk"})
            <script type="text/javascript">
                var editorContent = CKEDITOR.replace("recipeCk");
                CKFinder.setupCKEditor(editorContent, '/ckfinder/');
            </script>
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.Resource)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(m => m.Resource, new {@id = "resourceCk"})
            <script type="text/javascript">
                var editorContent = CKEDITOR.replace("resourceCk");
                CKFinder.setupCKEditor(editorContent, '/ckfinder/');
            </script>
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.GroupDishes)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(m => m.GroupDishes, (IEnumerable<SelectListItem>) ViewBag.ListGroupDishes, "----------Select GroupDishes----------")
        </div>
        <br/>
        <p>
            <input type="submit" name="btnSave" value="Save"/>
            <input type="submit" name="btnPreview" value="Preview"/>
        </p>
    </fieldset>
}